Return to doc.sitecore.com

Team Development with Sitecore
Prev Next

Author: Alexey Rusakov
Posted: 1/13/2006 7:05:00 PM

Visual Studio 2005 / ASP.NET 2.0 ships with two basic models, that is on-the-fly compilation and precompilation:

With first, you keep the source files with your pages / user controls and ASP.NET compiles them on the fly as the page is accessed. This allows a developer to see the changes immediately and avoid full project compilation. This also leads to a shortcoming: you need to keep your source code (not including your code library projects) at the web server. This model works rather well in the development environment. The model is not affected by Sitecore at all. Its also on by default - you don't need to perform any additional steps to make it work.

Precompilation, on the other hand, was designed to stage projects to production environment. All ASP.NET bits in the project folder get compiled into a number of assemblies and published to the web server. This even allows removing contents of the .html/.ascx files. The precompilation model received a lot of controversy around the web - and it’s also not an easy way to develop Sitecore solutions.
The VS web site project now includes all files in the site folder, it also does include the /sitecore and /upload folder. Because of that ASP.NET tries to recompile the /sitecore folder (which is already compiled) and that just doesn't work well. Having a large /upload folder also makes VS extremely unresponsive - this is also an issue with the on-the-fly compilation model. We've tried precompilation with the early 5.2 betas, but switched to the on-the-fly compilation after a few days.

There are also a number of 'tricks' which help to make the precompilation model even more usable. The Web deployment project allows, among other things, compiling your project into a single assembly instead of one-assembly-per-page or per-folder. There is also a posted link to a number of recipes on how to exclude certain files or folders from the VS project so that they aren't shown in VS2005 and do not get compiled. They seem a useful alternative.

One may also try the old way of doing everything in code library projects. While this does work, a big disadvantage is that you lose most of the VS 2005 new features related to .html/.ascx authoring. Some of them can be enabled by hacking the project file, but this is too inconsistent.

The last option covered here is the Web Application project. Due to a large number of complaints on the new project models, ASP.NET team decided to combine familiar VS 2003 web projects with VS 2005 new features like using partial classes for control declarations. This one is probably the most promising. Unfortunately, at the moment, there's only a preview release available which lacks some important features. Most noticeably, the partial classes used to keep auto-generated control declarations in are not updated when you change the page - so the old days of updating them manually are back. This will be fixed in the next refresh release and we are looking forward to trying it with Sitecore.

All mentioned models are only related to .ascx/.html ASP.NET bits, that is layouts and sublayouts in Sitecore world - you can still use code library projects for anything else like pipeline hooks, events, web controls and the rest.



Prev Next